<template>
  <div style="padding: 12px">
    <Tabs v-model="tabIndex0" name="tab1" >
      <TabPane label="场所图" tab="tab1">
        <Tabs v-model="tabIndex1" name="tab1-1">
          <TabPane label="场所" tab="tab1-1" style="padding-bottom: 200px">
            <div class="container">
              <div class="opt-area-02">
                <div class="input-frame" style="width: 100%;text-alone:left;margin-bottom:10px;font-size: 14px">
                  &nbsp;&nbsp;&nbsp;&nbsp;场所数: <span>{{params1.totalRecord}}</span>
                </div>
                <div class="left-con">
                  <div class="input-frame" style="width: 164px" v-if="severUserInfo.company_grade!=='5'">
                    <Select placeholder="请选择区" :disabled="Adisabled" v-model="params1.area_id" style="width:164px" clearable @on-change="findDistrictList(3,params1.area_id)">
                      <Option v-for="item in List1" :value="item.id" :key="item.id">{{ item.name }}</Option>
                    </Select>
                  </div>
                  <div class="input-frame" style="width: 164px" v-if="severUserInfo.company_grade!=='5'">
                    <Select placeholder="请选择街道" :disabled="Bdisabled" v-model="params1.street_id" style="width:164px" clearable @on-change="findDistrictList(4,params1.street_id)">
                      <Option v-for="item in List2" :value="item.id" :key="item.id">{{ item.name }}</Option>
                    </Select>
                  </div>
                  <div class="input-frame" style="width: 164px" v-if="severUserInfo.company_grade!=='5'">
                    <Select placeholder="请选择社区" v-model="params1.community_id" style="width:164px" clearable>
                      <Option v-for="item in List3" :value="item.id" :key="item.id">{{ item.name }}</Option>
                    </Select>
                  </div>
                  <div class="input-frame" style="width: 200px">
                    <Select v-model="params1.merchant_type" placeholder="商户类型" clearable style="width:200px">
                      <Option v-for="item in typelist" :value="item.id" :key="item.id">{{ item.name }}</Option>
                    </Select>
                  </div>
                  <div class="input-frame" style="width: 200px">
                    <Input type="text" @on-click="selectlist1(1)" placeholder="请输入名称" style="width: 200px" v-model="params1.name"
                           icon="ios-search"/>
                  </div>
                  <Button type="info" size="small" @click="selectlist1(1)" style="margin-top: 5px;margin-right:20px">搜索</Button>
                </div>
              </div>
            </div>
            <Table :loading="countData1.loading" border :columns="columns21" :data="DataList1" size="small" ref="table1">
              <template slot="place_time" slot-scope="{ row }">
                <span>{{row.place_time_begin}} - {{row.place_time_end}}</span>
              </template>
              <template slot="action" slot-scope="{ row }">
                <Button class="table-action-btn" type="error" size="small" @click="deletePlace(row)">删除</Button>
              </template>
            </Table>
            <Row type="flex" justify="end" class="page_style">
              <Page :current="params1.pageNo" :total="params1.totalRecord" show-sizer :page-size="params1.pageSize" show-elevator
                    @on-change="pageAction1" @on-page-size-change="pageSizeChange1"/>
            </Row>
          </TabPane>
<!--          <TabPane label="社会组织" tab="tab1-1">-->
<!--            <div class="container">-->
<!--              <div class="opt-area-02">-->
<!--                <div class="input-frame" style="width: 100%;text-alone:left;margin-bottom:10px;font-size: 14px">-->
<!--                  &nbsp;&nbsp;&nbsp;&nbsp;场所数: <span>{{paramsSubstance.totalRecord}}</span>-->
<!--                </div>-->
<!--                <div class="left-con">-->
<!--                  <div class="input-frame" style="width: 164px">-->
<!--                    <Select placeholder="请选择区" v-if="severUserInfo.company_grade === '2'" :disabled="Adisabled" v-model="params1.area_id" style="width:164px" clearable @on-change="findDistrictList(3,params1.area_id)" @on-clear="clearMsg(3)">-->
<!--                      <Option v-for="item in List1" :value="item.id" :key="item.id">{{ item.name }}</Option>-->
<!--                    </Select>-->
<!--                  </div>-->
<!--                  <div class="input-frame" style="width: 164px">-->
<!--                    <Select placeholder="请选择街道" v-if="severUserInfo.company_grade === '2'" :disabled="Bdisabled" v-model="params1.street_id" style="width:164px" clearable @on-change="findDistrictList(4,params1.street_id)" @on-clear="clearMsg(4)">-->
<!--                      <Option v-for="item in List2" :value="item.id" :key="item.id">{{ item.name }}</Option>-->
<!--                    </Select>-->
<!--                  </div>-->
<!--                  <div class="input-frame" style="width: 164px">-->
<!--                    <Select placeholder="请选择社区" v-if="severUserInfo.company_grade === '2'" v-model="params1.community_id" style="width:164px" clearable>-->
<!--                      <Option v-for="item in List3" :value="item.id" :key="item.id">{{ item.name }}</Option>-->
<!--                    </Select>-->
<!--                  </div>-->
<!--                  <div class="input-frame" style="width: 200px">-->
<!--                    <Select v-model="params1.merchant_type" placeholder="商户类型" clearable style="width:200px">-->
<!--                      <Option v-for="item in typelist" :value="item.id" :key="item.id">{{ item.name }}</Option>-->
<!--                    </Select>-->
<!--                  </div>-->
<!--                  <div class="input-frame" style="width: 200px">-->
<!--                    <Input type="text" @on-click="selectlist1(1)" placeholder="请输入名称" style="width: 200px" v-model="params1.name"-->
<!--                           icon="ios-search"/>-->
<!--                  </div>-->
<!--                  <Button type="info" size="small" @click="selectlist1(1)" style="margin-top: 5px;margin-right:20px">搜索</Button>-->
<!--                </div>-->
<!--              </div>-->
<!--              <Table :loading="loadingSubstance" border :columns="columnsSubstance" :data="dataListSubstance" size="small">-->
<!--                <template slot="action" slot-scope="{ row }">-->
<!--                  <Button class="table-action-btn" type="error" size="small">删除</Button>-->
<!--                </template>-->
<!--              </Table>-->
<!--              <Row type="flex" justify="end" class="page_style">-->
<!--                <Page :current="paramsSubstance.pageNo" :total="paramsSubstance.totalRecord" show-sizer :page-size="paramsSubstance.pageSize" show-elevator-->
<!--                      @on-change="pageActionSubstance" @on-page-size-change="pageSizeChangeSubstance"/>-->
<!--              </Row>-->
<!--            </div>-->
<!--          </TabPane>-->
<!--          <TabPane label="物件" tab="tab1-1">-->
<!--            <div class="container">-->
<!--              <div class="opt-area-02">-->
<!--                <div class="input-frame" style="width: 100%;text-alone:left;margin-bottom:10px;font-size: 14px">-->
<!--                  &nbsp;&nbsp;&nbsp;&nbsp;场所数: <span>{{paramsSociety.totalRecord}}</span>-->
<!--                </div>-->
<!--&lt;!&ndash;                <div class="left-con">&ndash;&gt;-->
<!--&lt;!&ndash;                  <div class="input-frame" style="width: 164px">&ndash;&gt;-->
<!--&lt;!&ndash;                    <Select placeholder="请选择区" v-if="severUserInfo.company_grade === '2'" :disabled="Adisabled" v-model="params1.area_id" style="width:164px" clearable @on-change="findDistrictList(3,params1.area_id)" @on-clear="clearMsg(3)">&ndash;&gt;-->
<!--&lt;!&ndash;                      <Option v-for="item in List1" :value="item.id" :key="item.id">{{ item.name }}</Option>&ndash;&gt;-->
<!--&lt;!&ndash;                    </Select>&ndash;&gt;-->
<!--&lt;!&ndash;                  </div>&ndash;&gt;-->
<!--&lt;!&ndash;                  <div class="input-frame" style="width: 164px">&ndash;&gt;-->
<!--&lt;!&ndash;                    <Select placeholder="请选择街道" v-if="severUserInfo.company_grade === '2'" :disabled="Bdisabled" v-model="params1.street_id" style="width:164px" clearable @on-change="findDistrictList(4,params1.street_id)" @on-clear="clearMsg(4)">&ndash;&gt;-->
<!--&lt;!&ndash;                      <Option v-for="item in List2" :value="item.id" :key="item.id">{{ item.name }}</Option>&ndash;&gt;-->
<!--&lt;!&ndash;                    </Select>&ndash;&gt;-->
<!--&lt;!&ndash;                  </div>&ndash;&gt;-->
<!--&lt;!&ndash;                  <div class="input-frame" style="width: 164px">&ndash;&gt;-->
<!--&lt;!&ndash;                    <Select placeholder="请选择社区" v-if="severUserInfo.company_grade === '2'" v-model="params1.community_id" style="width:164px" clearable>&ndash;&gt;-->
<!--&lt;!&ndash;                      <Option v-for="item in List3" :value="item.id" :key="item.id">{{ item.name }}</Option>&ndash;&gt;-->
<!--&lt;!&ndash;                    </Select>&ndash;&gt;-->
<!--&lt;!&ndash;                  </div>&ndash;&gt;-->
<!--&lt;!&ndash;                  <div class="input-frame" style="width: 200px">&ndash;&gt;-->
<!--&lt;!&ndash;                    <Select v-model="params1.merchant_type" placeholder="商户类型" clearable style="width:200px">&ndash;&gt;-->
<!--&lt;!&ndash;                      <Option v-for="item in typelist" :value="item.id" :key="item.id">{{ item.name }}</Option>&ndash;&gt;-->
<!--&lt;!&ndash;                    </Select>&ndash;&gt;-->
<!--&lt;!&ndash;                  </div>&ndash;&gt;-->
<!--&lt;!&ndash;                  <div class="input-frame" style="width: 200px">&ndash;&gt;-->
<!--&lt;!&ndash;                    <Input type="text" @on-click="selectlist1(1)" placeholder="请输入名称" style="width: 200px" v-model="params1.name"&ndash;&gt;-->
<!--&lt;!&ndash;                           icon="ios-search"/>&ndash;&gt;-->
<!--&lt;!&ndash;                  </div>&ndash;&gt;-->
<!--&lt;!&ndash;                  <Button type="info" size="small" @click="selectlist1(1)" style="margin-top: 5px;margin-right:20px">搜索</Button>&ndash;&gt;-->
<!--&lt;!&ndash;                </div>&ndash;&gt;-->
<!--              </div>-->
<!--              <Table :loading="loadingSociety" border :columns="columnsSociety" :data="dataListSociety" size="small" ref="table1">-->
<!--                <template slot="action" slot-scope="{ row }">-->
<!--                  <Button class="table-action-btn" type="error" size="small">删除</Button>-->
<!--                </template>-->
<!--              </Table>-->
<!--              <Row type="flex" justify="end" class="page_style">-->
<!--                <Page :current="paramsSociety.pageNo" :total="paramsSociety.totalRecord" show-sizer :page-size="paramsSociety.pageSize" show-elevator-->
<!--                      @on-change="pageActionSociety" @on-page-size-change="pageSizeChangeSociety"/>-->
<!--              </Row>-->
<!--            </div>-->
<!--          </TabPane>-->
        </Tabs>
      </TabPane>
      <TabPane label="居民图" tab="tab1">
        <div class="container">
          <div class="opt-area-02">
            <div class="input-frame" style="width: 100%;text-alone:left;margin-bottom:10px;font-size: 14px">
              &nbsp;&nbsp;&nbsp;&nbsp;总人数: <span>{{params.totalRecord}}</span>
            </div>
            <div class="left-con">
              <div class="input-frame" style="width: 300px">
                <Input type="text" @on-click="selectlist(1)" placeholder="请输入姓名" style="width: 300px" v-model="params.name"
                       icon="ios-search"/>
              </div>
              <div class="input-frame" style="width: 300px">
                <Input type="text" @on-click="selectlist(1)" placeholder="请输入身份证号" style="width: 300px" v-model="params.cardno"
                       icon="ios-search"/>
              </div>
              <div class="input-frame" style="width: 300px">
                <Input type="text" @on-click="selectlist(1)" placeholder="请输入联系方式" style="width: 300px" v-model="params.mobile"
                       icon="ios-search"/>
              </div>
              <Button type="info" size="small" style="margin-top: 5px;margin-right:10px;margin-left:10px" @click="focusGroupModel=true">选择人员标签</Button>
              <Button type="info" size="small" @click="selectlist(1)" style="margin-top: 5px;margin-right:10px">搜索</Button>
            </div>
            <div v-if="PickfocusGroupList.length > 0" class="left-con" style="margin-top: 5px">
              当前选择标签：<Tag v-for="(item,index) in PickfocusGroupList" :key="index">{{item.name}}</Tag>
            </div>
          </div>
          <Drawer title="选择人员标签" placement="left" :closable="false" v-model="focusGroupModel">
            <Tree ref="focusGroupTree" :data="focusGroupList" show-checkbox></Tree>
          </Drawer>
          <Table :loading="countData.loading" border :columns="columns2" :data="DataList" size="small" ref="table">
            <template slot="action" slot-scope="{ row }">
              <Row style="margin-bottom: 5px; margin-top: 2px">
                <Button class="table-action-btn" type="success" size="small" @click="fillUserInfo(row)">查看</Button>
              </Row>
            </template>
          </Table>
          <Row type="flex" justify="end" class="page_style">
            <Page :current="params.pageNo" :total="params.totalRecord" show-sizer :page-size="params.pageSize" show-elevator
                  @on-change="pageAction" @on-page-size-change="pageSizeChange"/>
          </Row>
          <person-info-modal :user-info="userInfo" :control-data="controlData" :severUserInfo="severUserInfo" ref="photo"></person-info-modal>
        </div>
      </TabPane>
    </Tabs>
    <Modal
        v-model="deleteModal"
        title="删除场所"
        @on-ok="deletePlaceConfirm">
      是否确认删除改场所信息！
    </Modal>
  </div>
</template>

<script>
import { findUserList, findMerchantUpList, userinfo, getAllPeopleNum, getUserListNum } from '@/api/eventlist'
import PersonInfoModal from '@/view/xian-page/mainv3/components/personInfoModal'
import {
  findGardenList,
  findGardenXJList,
  findGridZYList,
  findResourceMapList,
  deletePlace, findSubordinateList
} from '../../../../api/eventlist'

export default {
  name: 'someuserlist',
  components: {
    PersonInfoModal
  },
  data () {
    return {
      loadingSociety: false,
      columnsSociety: [],
      dataListSociety: [],
      paramsSociety: {
        pageNo: 1,
        pageSize: 10,
        totalRecord: 0
      },
      loadingSubstance: false,
      columnsSubstance: [],
      dataListSubstance: [],
      paramsSubstance: {
        pageNo: 1,
        pageSize: 10,
        totalRecord: 0
      },
      tabIndex0: 0,
      tabIndex1: 0,
      focusGroupModel: false,
      PickfocusGroupList: [],
      focusGroupList: [],
      openNow: false,
      fileName: 'photo.png',
      device_type: '',
      filePath: '',
      deviceUserInfo: {},
      Adisabled: false,
      Bdisabled: false,
      loadData: true,
      loading: false,
      modalStr: '',
      id: '',
      row: {},
      areaTypeList: [
        { value: '1', label: '大于' },
        { value: '2', label: '小于' },
        { value: '3', label: '等于' },
        { value: '4', label: '区间' }
      ],
      countData: { loading: false },
      countData1: { loading: false },
      countData2: { loading: false },
      params: {
        name: '',
        pageNo: 1,
        pageSize: 10,
        totalRecord: 0,
        cardno: '',
        mobile: '',
        area_id: '',
        street_id: '',
        community_id: '',
        garden_id: '',
        building_id: '',
        is_kgh: '',
        ym: '',
        ymAgeBegin: '',
        ymAgeEnd: ''
      },
      params1: {
        name: '',
        pageNo: 1,
        pageSize: 10,
        totalRecord: 0,
        area_type: '0',
        cardno: '',
        mobile: '',
        area_id: '',
        street_id: '',
        community_id: '',
        garden_id: '',
        building_id: '',
        is_kgh: '',
        ym: '',
        ymAgeBegin: '',
        ymAgeEnd: ''
      },
      params2: {
        name: '',
        pageNo: 1,
        pageSize: 10,
        totalRecord: 0,
        card_no: '',
        resident: '',
        point: ''
      },
      columns2: [
        { title: '姓名',
          key: 'name',
          // width: 100,
          align: 'center' },
        { title: '联系方式',
          key: 'mobile',
          // width: 120,
          align: 'center' },
        { title: '身份证号',
          key: 'TMcardno',
          // width: 160,
          align: 'center' },
        { title: '性别',
          key: 'sex',
          // width: 80,
          align: 'center' },
        // { title: '具体地址', key: 'present_address', minWidth: 250, align: 'center' },
        // { title: '是否入户', slot: 'doorplate_id', width: 100, align: 'center' },
        { title: '操作', align: 'center', width: 160, slot: 'action', fixed: 'right' }
      ],
      columns21: [
        { title: '名称', key: 'name', align: 'center' },
        { title: '商户类型', key: 'merchant_type_name', align: 'center' },
        { title: '场所面积', key: 'place_area', align: 'center' },
        { title: '场所负责人', key: 'place_fzr', align: 'center' },
        { title: '场所成立时间', key: 'place_cl_time', align: 'center' },
        { title: '场所负责人电话', key: 'place_fzr_phone', align: 'center' },
        { title: '场所地址', key: 'place_address', align: 'center' },
        { title: '场所营业时间', slot: 'place_time', align: 'center' },
        { title: '操作', align: 'center', width: 160, slot: 'action', fixed: 'right' }
      ],
      DataList: [],
      DataList1: [],
      userOverall: {},
      controlData: {
        show1: false,
        uploadHeader: false,
        readType: 1, // 读取当前人员信息的方式 0未读取 1输入卡号 2读身份证 3人脸对比
        cardnoInput: '',
        showDetail: false,
        photo: '',
        personTags: []
      },
      userInfo: {},
      severUserInfo: {},
      List1: [],
      List2: [],
      List3: [],
      typelist: [],
      url: '',
      GridGradenList: [],
      GridBuildingList: [],
      deleteModal: false,
      deletePlaceInfo: {}
    }
  },
  methods: {
    pageActionSociety (page) {
      this.paramsSociety.pageNo = page
    },
    pageSizeChangeSociety (e) {
      this.paramsSociety.pageSize = e
    },
    pageActionSubstance (page) {
      this.paramsSubstance.pageNo = page
    },
    pageSizeChangeSubstance (e) {
      this.paramsSubstance.pageSize = e
    },
    deletePlace (e) {
      this.deleteModal = true
      this.deletePlaceInfo = e
    },
    deletePlaceConfirm () {
      let data = {
        id: this.deletePlaceInfo.id
      }
      deletePlace(data).then(ret => {
        if (ret.data.errcode === 0) {
          this.$Notice.success({ title: '删除成功！', desc: ret.data.errmsg })
          this.getList1()
        } else {
          this.$Notice.error({ title: '删除失败！', desc: ret.data.errmsg })
        }
      })
    },
    pageAction (page) {
      this.params.pageNo = page
      this.getList()
    },
    pageAction1 (page) {
      this.params1.pageNo = page
      this.getList1()
    },
    selectlist () {
      this.params.pageNo = 1
      this.getList()
    },
    selectlist1 () {
      this.params1.pageNo = 1
      this.getList1()
    },
    findDistrictList (e1, e2) {
      let data = {
        grade: e1,
        id: e2
      }
      findSubordinateList(data).then(ret => {
        if (ret.data.errcode === 0) {
          if (e1 === 2) {
            this.List1 = ret.data.data
          } else if (e1 === 3) {
            this.List2 = ret.data.data
          } else if (e1 === 4) {
            this.List3 = ret.data.data
          }
        } else {
          this.$Notice.error({
            title: '查询失败',
            desc: ret.data.errmsg
          })
        }
      })
    },
    getList () {
      this.countData.loading = true
      if (this.severUserInfo.company_grade === '2') {
        this.url = '/api/ac/grid/userRegisterService/findUserLMList'
        if ((this.params.area_id === '' || this.params.area_id === undefined) &&
          (this.params.street_id === '' || this.params.street_id === undefined) &&
          (this.params.community_id === '' || this.params.community_id === undefined)) {
          this.url = '/api/ac/grid/userRegisterService/findUserLMList'
        } else {
          this.url = '/api/as/grid/user/findUserList'
        }
      } else {
        this.url = '/api/as/grid/user/findUserList'
      }
      this.params.tagfocusGroupList = []
      this.$refs.focusGroupTree.getCheckedNodes().forEach(item => {
        this.params.tagfocusGroupList.push(item.value)
      })
      if (this.params.ymAgeBegin || this.params.ymAgeEnd) {
        var pattern = /[0-9]\d*/
        if (!pattern.test(this.params.ymAgeBegin)) {
          this.$Notice.error({
            title: '查询失败！！',
            desc: '开始年龄请输入数字！'
          })
          this.countData.loading = false
          return
        }
        if (!pattern.test(this.params.ymAgeEnd)) {
          this.$Notice.error({
            title: '查询失败！！',
            desc: '结束年龄请输入数字！'
          })
          this.countData.loading = false
          return
        }
      }
      if (this.params.ymAgeBegin) {
        if (!this.params.ymAgeEnd) {
          this.$Notice.error({
            title: '查询失败！！',
            desc: '结束年龄和开始年龄都需要选择！'
          })
          this.countData.loading = false
          return
          // /[1-9]\d*/
        }
      }
      if (this.params.ymAgeEnd) {
        if (!this.params.ymAgeBegin) {
          this.$Notice.error({
            title: '查询失败！！',
            desc: '开始年龄和结束年龄都需要选择！'
          })
          this.countData.loading = false
          return
        }
      }
      if (parseInt(this.params.ymAgeBegin) > parseInt(this.params.ymAgeEnd)) {
        this.$Notice.error({
          title: '查询失败！！',
          desc: '开始年龄需小于结束年龄！'
        })
        this.countData.loading = false
        return
      }
      console.log(this.params)
      findUserList(this.params, this.url).then(res => {
        if (res.data.errcode === 0) {
          this.DataList = res.data.data.results
          if (this.url === '/api/ac/grid/userRegisterService/findUserLMList') {
            this.getAllPeopleNum(this.params)
            // this.getAllPeopleUserTypeNum(this.params)
            // this.getAllPeopleJuZhuTypeNum(this.params)
          } else {
            this.getUserListNum(this.params)
            // this.getUserTypeNumList(this.params)
            // this.getJuZhuTypeNum(this.params)
            // this.params.totalRecord = res.data.data.totalRecord
          }
          if (this.params.ym === 'no') {
            // this.params.ym === '18' || this.params.ym === '1218' || this.params.ym === '12'
            if (this.columns2.findIndex(item => item.key === 'reason') === -1) {
              this.columns2.push({
                title: '疫苗未接种原因',
                key: 'reason',
                minWidth: 250,
                align: 'center'
              })
            }
          } else {
            if (this.columns2.findIndex(item => item.key === 'reason') !== -1) {
              this.columns2.splice(this.columns2.findIndex(item => item.key === 'reason'), 1)
            }
          }
        } else {
          this.$Notice.error({
            title: '查询列表信息失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    getList1 () {
      this.countData1.loading = true
      if (this.params1.area_type && this.params1.area_type !== '0' && this.params1.area_type === '4') {
        if (!this.params1.place_area_start) {
          this.$Notice.error({
            title: '请输入正确面积区间1'
          })
          this.countData1.loading = false
          return
        }
        if (!this.params1.place_area_end) {
          this.$Notice.error({
            title: '请输入正确面积区间2'
          })
          this.countData1.loading = false
          return
        }
        if (this.params1.place_area_end <= this.params1.place_area_start) {
          this.$Notice.error({
            title: '请输入正确面积区间3'
          })
          this.countData1.loading = false
          return
        }
      }
      if (this.params1.area_type && this.params1.area_type !== '0' && this.params1.area_type !== '4') {
        if (!this.params1.place_area_one) {
          this.$Notice.error({
            title: '请输入正确面积'
          })
          this.countData1.loading = false
          return
        }
      }
      findMerchantUpList(this.params1).then(res => {
        if (res.data.errcode === 0) {
          this.DataList1 = res.data.data.results
          this.params1.totalRecord = res.data.data.totalRecord
          this.countData1.loading = false
        } else {
          this.countData1.loading = false
          this.$Notice.error({
            title: '查询列表信息失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    getTypeList () {
      findGridZYList({ type: 'p' }).then(res => {
        if (res.data.errcode === 0) {
          this.typelist = res.data.data
        } else {
          this.$Notice.error({
            title: '获取商户类型失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    getUserListNum (e) {
      getUserListNum(e).then(ret => {
        if (ret.data.errcode === 0) {
          this.params.totalRecord = ret.data.data.num
          this.countData.loading = false
        } else {
          this.$Notice.error({
            title: '查询列表信息数量失败',
            desc: ret.data.errmsg
          })
        }
      })
    },
    getAllPeopleNum (e) {
      getAllPeopleNum(e).then(ret => {
        if (ret.data.errcode === 0) {
          this.params.totalRecord = ret.data.data.num
          this.countData.loading = false
        } else {
          this.$Notice.error({
            title: '查询列表信息数量失败',
            desc: ret.data.errmsg
          })
        }
      })
    },
    pageSizeChange (e) {
      this.params.pageSize = e
      this.selectlist(this.params.pageNo)
    },
    pageSizeChange1 (e) {
      this.params1.pageSize = e
      this.selectlist1(this.params.pageNo)
    },
    // 完善用户信息
    fillUserInfo (item) {
      this.userOverall = item
      if (!this.userOverall.id) return
      this.getUserInfo(item.cardno)
      this.controlData.showDetail = true
    },
    getUserInfo (cardno) {
      this.controlData.cardno = cardno
      this.userOverall.cardno = cardno
      userinfo(cardno).then(res => {
        if (res.data.errcode === 0) {
          this.userInfo = res.data.data
          if (this.userInfo.photo === undefined) {
            this.userInfo.photo = ''
          }
          // this.$refs.photo.photoShow(this.userInfo.photo)
          if (this.userInfo.focus_group) {
            this.controlData.personTags = this.userInfo.focus_group.split(',')
          } else {
            this.controlData.personTags = []
          }
          // 不论是否上传头像，查询个人信息时包含头像则不上传
          if (this.userInfo.photo) {
            this.controlData.photo = this.userInfo.photo
            this.controlData.uploadHeader = false
          } else {
            this.controlData.photo = this.controlData.photo || this.nophoto
          }
          if (this.controlData.readType !== 2) {
            this.userOverall.name = this.userInfo.name
            this.userOverall.address = this.userInfo.address
            this.userOverall.sex = this.userInfo.sex
            this.userOverall.folk = this.userInfo.folk
          }
          this.userOverall.readCount++
          this.userOverall.id = this.userInfo.id
          this.userOverall.userInfo = this.userInfo
        } else {
          this.$Notice.error({ title: '查询失败！', desc: res.data.errmsg })
        }
      })
    },
    clearMsg (e1) {
      if (e1 === 3) {
        this.params.area_id = ''
        this.params.street_id = ''
        this.params.community_id = ''
      } else if (e1 === 4) {
        this.params.street_id = ''
        this.params.community_id = ''
      }
    },
    clearGrid (e) {
      if (e === 6) {
        this.params.garden_id = ''
        this.params.building_id = ''
      } else if (e === 7) {
        this.params.building_id = ''
      }
    },
    findGridGradenList () {
      findGardenList().then(ret => {
        if (ret.data.errcode === 0) {
          this.GridGradenList = ret.data.data
        } else {
          this.$Notice.error({ title: '获取失败', desc: ret.data.errmsg })
        }
      })
    },
    findGridBuildingList (e) {
      let data = {
        id: e
      }
      findGardenXJList(data).then(ret => {
        if (ret.data.errcode === 0) {
          this.GridBuildingList = ret.data.data
        } else {
          this.$Notice.error({ title: '获取失败', desc: ret.data.errmsg })
        }
      }
      )
    },
    findGridModuleList () {
      findResourceMapList().then(ret => {
        this.focusGroupList = ret.data.data
      })
    }
  },
  mounted () {
    this.severUserInfo = this.$store.state.user.severUserInfo
    this.getList()
    this.getList1()
    this.getTypeList()
    this.findGridModuleList()
  },
  watch: {
    'severUserInfo.company_grade' (val) {
      if (val === '2') {
        this.findDistrictList(2, '999999999')
      } else if (val === '3') {
        this.findDistrictList(2, '999999999')
        this.params1.area_id = this.severUserInfo.company_id
        this.findDistrictList(3, this.params1.area_id)
        this.Adisabled = true
      } else if (val === '4') {
        this.findDistrictList(2, '999999999')
        this.params1.area_id = this.severUserInfo.parent_id
        this.findDistrictList(3, this.params1.area_id)
        this.params1.street_id = this.severUserInfo.company_id
        this.findDistrictList(4, this.params1.street_id)
        this.Adisabled = true
        this.Bdisabled = true
      } else if (val === '5') {
        // this.findGridGradenList()
      }
    },
    focusGroupModel (val) {
      if (!val) {
        this.PickfocusGroupList = []
        this.PickfocusGroupList = this.$refs.focusGroupTree.getCheckedNodes()
        console.log(this.PickfocusGroupList, '========------')
      }
    }
  }
}
</script>

<style scoped>
  .page_style {
    margin: 20px 5px;
  }

  .input-frame {
    width: 120px;
    margin-right: 10px;
    float: left;
  }

  .house-list > .group {
    background: white;
    padding: 10px;
    margin-top: 10px;
  }

  .house-list > .group > .item {
    border-bottom: 1px solid #f5f5f5;
    padding: 10px 0;
  }

  .house-list > .group > .item .top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
  }

  .house-list > .group > .item .title {
    font-size: 14px;
    color: #333333;
  }

  .house-list > .group > .item .address {
    font-size: 12px;
    color: gray;
    display: flex;
    align-items: center;
  }

  .house-list > .group > .item .detail {
    font-size: 12px;
    color: dodgerblue;
  }

  .opt-area-02 {
    display: flex;
    align-items: center;
    flex-direction: column;
    border: 1px solid #abdcff;
    background-color: #f0faff;
    padding: 8px 16px 8px 16px;
    border-radius: 4px;
    margin-bottom: 10px;
  }

  .opt-area-02 .right-con {
    width: 100%;
    margin-top: 5px;
    display: flex;
  }

  .opt-area-02 .left-con {
    font-size: 14px;
    width: 100%;
  }

  .opt-area-02 .left-con span {
    font-weight: bold;
  }

  .opt-area-02 .right-con input {
    width: 150px;
    margin-right: 10px;
  }

  .opt-area-02 .right-con .input-frame {
    width: 200px;
    margin-right: 10px;
  }

  .table-action-btn {
    margin-bottom: 3px;
  }

  .container >>> .ivu-btn-small {
    /*height: 24px;*/
    height: auto;
    padding: 0 5px;
    font-size: 12px;
    border-radius: 3px;
  }

  .btn-action {
    margin-bottom: 10px;
  }

  .mp10 {
    margin-right: 10px;
  }
  .title-style {
    color: red;
  }
  .mb20 {
    margin-bottom: 20px;
  }
  .ivu-table-row {
    height: 57px;
  }
  .demo-spin-icon-load{
    animation: ani-demo-spin 1s linear infinite;
  }
  @keyframes ani-demo-spin {
    from { transform: rotate(0deg);}
    50%  { transform: rotate(180deg);}
    to   { transform: rotate(360deg);}
  }
  .demo-spin-col{
    height: 100px;
    position: relative;
    /*border: 1px solid #eee;*/
  }
  .container>>>.ivu-icon-ios-arrow-forward:before{
    color: black;
  }
</style>
